﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using xfsale.lib;
using xfsale.ui;

namespace xfsale.ui.acct
{
    public partial class FrmTAAcctRegister : FrmBase
    {
        public FrmTAAcctRegister()
        {
            InitializeComponent();
        }

        /*private void HandleResponse(Pack response)
        {
            if (response.GetBaseByName("ReturnCode") == "0000")
            {
                txtOrderSheetNo.Text = response.GetRecordByName("OrderSheetNo");
                MessageBox.Show(response.GetBaseByName("ReturnMsg"));
            }
            else
            {
                MessageBox.Show(response.GetBaseByName("ReturnMsg"));
            }
        }*/

        private void BtnOk_Click(object sender, EventArgs e)
        {
            string password = string.Empty;
            WinPassword frmPassword = new WinPassword();
            DialogResult result = frmPassword.ShowDialog();
            if (result == DialogResult.Cancel)
            {
                frmPassword.Dispose();
                return;
            }

            if (result == DialogResult.OK)
            {
                password = frmPassword.Password;
                frmPassword.Dispose();
            }

            /*try
            {
                //初始化请求包
                Log.LogDebug("初始化请求包");
                request.ServiceCode = "101201";
                request.PackType = "R";
                request.Init();

                //填充请求包基础数据
                Log.LogDebug("填充请求包基础数据");
                request.SetBaseByName("ServiceCode", "101201");
                request.SetBaseByName("ChannelCode", "001");
                request.SetBaseByName("RegionCode", "0001");
                request.SetBaseByName("BranchCode", "000100001");
                request.SetBaseByName("AcceptMethod", "0");
                request.SetBaseByName("OpID", "00000001");

                //填充请求包记录数据
                Log.LogDebug("填充请求包记录数据");
                FillRequestByAuto(this);
                request.SetRecordByName("TradePassword", frmPassword.Password);

                //调用服务
                Log.LogInfo("开始调用服务");
                App.CallService("A101201", HandleResponse);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //释放请求包
                Log.LogDebug("释放请求包");
                request.Dispose();
            }*/
        }

        private void BtnClear_Click(object sender, EventArgs e)
        {
            Reset();
        }

        private void BtnClose_Click(object sender, EventArgs e)
        {
            CloseFrame();
        }

        private void FrmAcctTransOpen_Load(object sender, EventArgs e)
        {
            if (!this.DesignMode)
            {
                //FillCmbByAuto(this);
            }
        }
    }
}
